package crm.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

import crm.dto.Page;
import crm.service.CustomerService;
import crm.service.ThreadService;
import crm.service.impl.CustomerServiceImpl;
import crm.service.impl.ThreadServiceImpl;

/**
 * Servlet implementation class ThreadListServlet
 */
public class ThreadListServlet extends HttpServlet {
	
	private static final long serialVersionUID = 1L;

	private ThreadService threadService = new ThreadServiceImpl();
	
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		
		
		String pageSize = request.getParameter("pageSize");
		String pageNO = request.getParameter("pageNO");
	
		Page customerListQ = threadService.getCustomerListQ(Integer.parseInt(pageSize), Integer.parseInt(pageNO));
		
		String json = JSON.toJSONString(customerListQ,SerializerFeature.WriteDateUseDateFormat);
		
		response.getWriter().write(json);
		
		
	}

}
